<template>
  <el-container class="home">
    <el-header>
      <h1 class="title">健康管理系统</h1>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu :default-active="$route.path.slice(1).split('-')[0]"
                 class="el-menu-vertical-demo"
                 background-color="#545c64"
                 text-color="#fff"
                 active-text-color="#ffd04b"
                 unique-opened
                 router>
          <el-submenu v-for="menu in menuList"
                      :key="menu.id"
                      :index="menu.path">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>{{menu.authName}}</span>
            </template>
            <!-- 放菜单项 -->
            <el-menu-item v-for="item in menu.children"
                          :index="item.path"
                          :key="item.id">
              <i class="el-icon-menu"></i>
              <span slot="title">{{item.authName}}</span>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <!-- 配置了子路由的出口 -->
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import axios from "axios"
import { posturl, geturl } from '../static/js/util.js'
export default {
  data () {
    return {
      menuList: [
        {
          id: 2,
          authName: '文件种类',
          path: 'examination',
          children: [{
            authName: '体检文件',
            path: 'examination',
            id: 111
          },
          {
            authName: '病例文件',
            path: 'case',
            id: 111
          }]
        },
      ]
    }
  },
  methods: {
  },
  async created () {


  }
}
</script>

<style lang="less" scoped>
// 如果给style添加scoped属性，样式只会在当前组件生效
// 实现原理： 如果给当前组件的style添加了scoped,,,,把当前组件中所有的div都增加一个随机的属性
.home {
  height: 100%;
  .el-header {
    background-color: #b3c1cd;

    .logo {
      width: 180px;
      height: 60px;
      float: left;
      // background-image: url("../assets/logo.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center center;
    }
    .logout {
      width: 180px;
      height: 60px;
      float: right;
      line-height: 60px;
      text-align: right;
      font-weight: 700;
      a {
        color: darkorange;
      }
    }

    .title {
      height: 60px;
      overflow: hidden;
      text-align: center;
      line-height: 60px;
      color: #fff;
      font-size: 30px;
    }
  }
  .el-aside {
    background-color: #545c64;

    .el-submenu {
      width: 200px;
    }
  }
  .el-main {
    background-color: #d4dfe4;
  }
}
</style>
